package com.lam.dormitory.mapper;

import com.lam.dormitory.entity.Permission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lam
 * @since 2019-12-20
 */
public interface PermissionMapper extends BaseMapper<Permission> {

    /**
     * 根据角色查询用户权限
     * @param roleId
     * @return
     */
    List<Permission> selectPermissionByRoleId(Long roleId);

    /**
     *
     * @param permission
     * @return
     */
    List<Permission> selectByPermission(Permission permission);
    /**
     * 查询全部菜单
     * @return list
     */
    List<Permission> selectAllMenuName();

    /**
     * 查询子权限条数
     * @param permissionId
     * @return int
     */
    int selectSubPermsByPermissionId(Long permissionId);

    /**
     * 查询子权限
     * @param permissionId
     * @return
     */
    List<Permission> selectPermsAndChildren(Long permissionId);

    /**
     * 根据用户id查询菜单
     * @param userId 用户id
     * @return the list
     */
    List<Permission> selectMenuByUserId(Long userId);


}
